package com.cj.tool.http;

/**
 * 自定义错误信息，统一处理返回处理
 *
 * @author zengyi
 * create at 2017/1/10 9:39
 */
public class HttpTimeException extends RuntimeException {


	public HttpTimeException(String resultCode, String msg) {
		this(getApiExceptionMessage(resultCode, msg));
	}


	public HttpTimeException(String detailMessage) {
		super(detailMessage);

	}


	/**
	 * 转换错误数据
	 *
	 * @param code
	 * @return
	 */
	private static String getApiExceptionMessage(String code, String msg) {
		switch (code) {
			//token无效 重新登陆
			case "204":
				msg = "登录失效,请重新登录";
				break;

			default:
				break;
		}
		return msg;
	}

}